<input placeholder="{{ widget.tag_args.placeholder }}" autocomplete="off" type="{{ widget.type }}"
       name="{{ widget.name }}"{% if widget.value != None %}
       value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
<script>
    {% if widget.tag_args.var_name %}
        var {{widget.tag_args.var_name}} = {% endif %}  new Tagify(document.querySelector('input[name={{widget.name}}]'),
        {
        {% if widget.tag_args.maxTags != None %}maxTags:{{widget.tag_args.maxTags}},{%endif%}
        {% if widget.tag_args.pattern %}pattern:/{{widget.tag_args.pattern}}/,{%endif%}
        delimiters: "{{widget.tag_args.delimiters}}",
        whitelist: {{widget.tag_args.whitelist|safe}},
        suggestionsMinChars:{{widget.tag_args.suggestionsMinChars}},
        blacklist:{{widget.tag_args.blacklist|safe}},
        originalInputValueFormat: valuesArr => valuesArr.map(item => item.value).join('{{ widget.tag_args.delimiters }}')
    })
</script>